MyDesktop.UploadManager = Ext.extend(Ext.app.Module, {
	id:'upload-manager',
    init : function(){
        this.launcher = {
            text: '文件上传',
            iconCls:'bogus',
            handler : this.createWindow,
            scope: this
        }
    },

    createWindow : function(){
        var desktop = this.app.getDesktop();
        var win = desktop.getWindow('upload-manager');
	        win = desktop.createWindow({
	        id: '7',
	        title:'文件上传',
	        width:640,
	        height:480,
	        items:
	        	 new Ext.TabPanel({
                        activeTab:0,
                        items: [{
                            title: '简单上传',
                            header:false,
                            html : '<p>Something useful would be in here.</p>',
							autoHeight:true,
							html:'<form method="POST" enctype="multipart/form-data" action="/beautyos/index.php/fileManager/simpleUpload" target="uploadIframe">'
								+'<lable>文件上传</label><br/>'
								+ '<input type="hidden" name="dir_id" value="7"/>'
								+ '<input type="file" name="upload[]"/></form>'
								+ '<input type="submit" value="上传"/>'
								+ '<iframe name="uploadIframe" id="uploadIframe" style="display:block;"></iframe></form>',
                            border:false
                        },{
                            title: '高级上传',
                            header:false,
                            html:'<OBJECT id="FlashFilesUpload" codeBase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"width="550" height="400" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" VIEWASTEXT>'
		                    	+ '<PARAM NAME="FlashVars" VALUE="uploadUrl=&uploadButtonVisible=No">'
		                    	+ '<PARAM NAME="BGColor" VALUE="#F8F6E6">'
		                    	+ '<PARAM NAME="Movie" VALUE="/beautyos/system/ventor/swf/ElementITMultiPowUpload1.8.swf">'
		                    	+ '<PARAM NAME="Src" VALUE="/beautyos/system/ventor/swf/ElementITMultiPowUpload1.8.swf">'
		                    	+ '<PARAM NAME="WMode" VALUE="Window">'
		                    	+ '<PARAM NAME="Play" VALUE="-1">'
		                    	+ '<PARAM NAME="Loop" VALUE="-1">'
		                    	+ '<PARAM NAME="Quality" VALUE="High">'
		                    	+ '<PARAM NAME="SAlign" VALUE="">'
		                    	+ '<PARAM NAME="Menu" VALUE="-1">'
		                    	+ '<PARAM NAME="Base" VALUE="">'
		                    	+ '<PARAM NAME="AllowScriptAccess" VALUE="always">'
		                    	+ '<PARAM NAME="Scale" VALUE="ShowAll">'
		                    	+ '<PARAM NAME="DeviceFont" VALUE="0">'
		                    	+ '<PARAM NAME="EmbedMovie" VALUE="0">'
		                    	+ '<PARAM NAME="SWRemote" VALUE="">'
		                    	+ '<PARAM NAME="MovieData" VALUE="">'
		                    	+ '<PARAM NAME="SeamlessTabbing" VALUE="1">'
		                    	+ '<PARAM NAME="Profile" VALUE="0">'
		                    	+ '<PARAM NAME="ProfileAddress" VALUE="">'
		                    	+ '<PARAM NAME="ProfilePort" VALUE="0">'
		                    	+ '<embed bgcolor="#F8F6E6" id="EmbedFlashFilesUpload" src="/beautyos/system/ventor/swf/ElementITMultiPowUpload1.8.swf" quality="high" pluginspage="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"	type="application/x-shockwave-flash" width="400" height="350" flashvars="uploadUrl=&uploadButtonVisible=No">'
		                    	+ '</embed></OBJECT><br/>'
		                    	+ '<input onClick="AdvanceUpload();" type="button" value="Send Files" />',
                            border:false
                        }]
                    })
	        	
         });
        
        win.show();
		if(win) {
			updateAppStatues(win.id,'on');
		}

    }
});

/**
*AdvanceUpload
*/
function AdvanceUpload() {
	var Flash;
	var ServerUrl = '/beautyos/index.php/';
	var url = ServerUrl + 'upload/AdvancedUpload';
    if(document.embeds && document.embeds.length>=1 && navigator.userAgent.indexOf("Safari") == -1)
		Flash = document.getElementById("EmbedFlashFilesUpload");
	else
		Flash = document.getElementById("FlashFilesUpload");
    //alert(url);
    Flash.SetVariable("uploadUrl",url);
	Flash.SetVariable("SubmitFlash", "");
}
